package com.huanshi.security.model;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

public class MemberUserDetails implements UserDetails {
    //用户id
    private Integer userId;
    //用户名
    private String username;
    //密码
    private String password;

    private Collection<? extends GrantedAuthority> authorities;

    /**
     * 获取权限列表
     * @return Collection
     */
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    /**
     * 获取用户Id
     * @return String
     */
    public Integer getUserId() {
        return userId;
    }

//    /**
//     * 获取用户类型
//     * @return String
//     */
//    public String getUserType() {
//        return userType;
//    }
    /**
     * 获取密码
     * @return String
     */
    @Override
    public String getPassword() {
        return password;
    }

    /**
     * 获取用户名
     * @return String
     */
    @Override
    public String getUsername() {
        return username;
    }

    /**
     * 账号是否未过期
     * @return boolean
     */
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    /**
     * 账号是否未锁定
     * @return boolean
     */
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    /**
     * 凭证是否未过期
     * @return boolean
     */
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    /**
     * 账号是否已启用
     * @return boolean
     */
    @Override
    public boolean isEnabled() {
        return true;
    }
}
